package com.yihu.wlyy.repository;

import com.yihu.wlyy.entity.SbInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

/**
 * Created by lyr on 2016/8/8.
 */
public interface SbInfoDao extends PagingAndSortingRepository<SbInfo, String>, JpaSpecificationExecutor<SbInfo> {

    SbInfo findBySfzh18(String idcard);

    @Query("select a from SbInfo a where a.id = (select max(b.id) from SbInfo b where b.sfzh18 = ?1)")
    SbInfo findBySfzh18Max(String idcard);


    @Query("select a from SbInfo a where a.id = (select max(b.id) from SbInfo b where b.id0000 = ?1)")
    SbInfo findBySfzh15Max(String idcard);
}
